<?php
$this->load->helper('form');
$attributes = array('onsubmit' => 'pkgAddRequest(); return false;');
echo form_open('#',$attributes);
?>
<table>
	<tr>
		<td class='form-field'> <strong> Name :</strong></td>
		<td><?php
		$data = array(
		              'name'        => 'name',
		              'id'          => 'name',
		              'maxlength'   => '50',
		              'size'        => '50',
		              'value'		=> $values['name_val']
		            );
		echo form_input($data);
		?>
		</td>
		<td class='error_message'><?=$errors['name_err'];?></td>
	</tr>
	
	<tr>
		<td class='form-field'> <strong> Website :</strong></td>
		<td><?php
		$data = array(
		              'name'        => 'website',
		              'id'          => 'website',
		              'maxlength'   => '150',
		              'size'        => '50',
		              'value'		=> $values['website_val']
		            );
		echo form_input($data);
		?>
		</td>
		<td class='error_message'><?=$errors['website_err'];?></td>
	</tr>
	
	<tr>
		<td class='form-field'> <strong> Licence :</strong></td>
		<td><?php
		$data = array(
		              'name'        => 'licence',
		              'id'          => 'licence',
		              'maxlength'   => '30',
		              'size'        => '30',
		              'value'		=> $values['licence_val']
		            );
		echo form_input($data);
		?>
		</td>
		<td class='error_message'><?=$errors['licence_err'];?></td>
	</tr>
	
	<tr>
		<td class='form-field'> <strong> Category :</strong></td>
		<td><?php
		$options = array();
		foreach ($categories as $value)
			$options[$value] = $value;
        
        $data = array(
		              'name'        => 'radio-cat',
		              'id'          => 'rad-catlist',
		              'value'       => 'rad-catlist',
		              'checked'     => TRUE
            );

		echo form_radio($data).' ';
		$def_cat = '';
		if (count($categories) > 0)
			$def_cat = $categories[0];
		echo form_dropdown('category-list', $options, $def_cat, 'id="category-list" onfocus="$(\'rad-catlist\').checked = true;"').' ';
		
		$data['id'] = $data['value'] = 'rad-catnew';
		$data['checked'] = FALSE;
		echo form_radio($data).' ';
		
		if ($values['category_val'] == '')
			$values['category_val'] = 'New category';
		$data = array(
		              'name'        => 'category-new',
		              'id'          => 'category-new',
		              'maxlength'   => '30',
		              'size'        => '30',
		              'value'		=> $values['category_val'],
					  'onfocus'     => '$(\'rad-catnew\').checked = true;'
		            );
		echo form_input($data);
		
		?>
		</td>
	</tr>
	
	<tr>
		<td class='form-field'> <strong> Short description :</strong></td>
		<td><?php
		$data = array(
		              'name'        => 'short_desc',
		              'id'          => 'short_desc',
		              'rows'		=> '10',
		              'cols'        => '30',
		              'value'		=> $values['short_desc_val']
		            );
		echo form_textarea($data);
		?>
		</td>
		<td class='error_message'><?=$errors['short_desc_err'];?></td>
	</tr>
	<tr>
		<td class='form-field'>
			<?php echo form_submit('submit', 'Send'); ?>
		</td>
	</tr>
</table>

<?php
echo form_close('');
?>
